class CreateProfitStatements < ActiveRecord::Migration
  def self.up
    create_table :profit_statements do |t|
      t.string :stock_no
      t.string :report_date #=>报告期

      t.decimal :main_operating_revenue, :precision => 20, :scale => 2 #=>主营业务收入
      t.decimal :discount_and_allowance, :precision => 20, :scale => 2 #=>折扣与折让
      t.decimal :net_income_from_main_operation, :precision => 20, :scale => 2 #=>主营业务收入净额
      t.decimal :operating_costs, :precision => 20, :scale => 2 #=>主营业务成本
      t.decimal :sales_tax, :precision => 20, :scale => 2 #=>主营业务税金及附加
      t.decimal :main_operating_profit, :precision => 20, :scale => 2 #=>主营业务利润
      t.decimal :other_operation_profit, :precision => 20, :scale => 2 #=>其他业务利润
      t.decimal :loss_on_inventory, :precision => 20, :scale => 2 #=>存货跌价损失
      t.decimal :operating_expenses, :precision => 20, :scale => 2 #=>营业费用
      t.decimal :management_fee, :precision => 20, :scale => 2 #=>管理费用
      t.decimal :financial_expenses, :precision => 20, :scale => 2 #=>财务费用
      t.decimal :operating_profit, :precision => 20, :scale => 2 #=>营业利润
      t.decimal :return_on_investment, :precision => 20, :scale => 2 #=>投资收益
      t.decimal :subsidy_income, :precision => 20, :scale => 2 #=>补贴收入
      t.decimal :non_operating_income, :precision => 20, :scale => 2 #=>营业外收入
      t.decimal :non_operation_expenses, :precision => 20, :scale => 2 #=>营业外支出
      t.decimal :prior_year_income_adjustment, :precision => 20, :scale => 2 #=>以前年度损益调整
      t.decimal :net_non_operating_income, :precision => 20, :scale => 2 #=>营业外收支净额
      t.decimal :total_profit, :precision => 20, :scale => 2 #=>利润总额
      t.decimal :incoming_tax, :precision => 20, :scale => 2 #=>所得税
      t.decimal :financial_return, :precision => 20, :scale => 2 #=>财政返还
      t.decimal :minority_equity, :precision => 20, :scale => 2 #=>少数股东权益
      t.decimal :net_profit_before_buy, :precision => 20, :scale => 2 #=>购买日前净利润
      t.decimal :unrecognized_investment_losses, :precision => 20, :scale => 2 #=>未确认的投资损失
      t.decimal :net_profit, :precision => 20, :scale => 2 #=>净利润
      t.decimal :profit_available_for_distribution, :precision => 20, :scale => 2 #=>年初未分配利润
      t.decimal :prior_year_income_adjustment, :precision => 20, :scale => 2 #=>调整以前年度损益
      t.decimal :reserve_into, :precision => 20, :scale => 2 #=>盈余公积转入
      t.decimal :revolving_fund_of_house_into, :precision => 20, :scale => 2 #=>住房周转金转入
      t.decimal :other_into, :precision => 20, :scale => 2 #=>其他转入
      t.decimal :attributable_profit, :precision => 20, :scale => 2 #=>可分配利润
      t.decimal :withdrawal_legal_surplus, :precision => 20, :scale => 2 #=>提取法定盈余公积
      t.decimal :withdrawal_legal_public_welfare_funds, :precision => 20, :scale => 2 #=>提取法定公益金
      t.decimal :welfare_workers_bonuses, :precision => 20, :scale => 2 #=>职工奖金福利
      t.decimal :withdrawal_reserve_fund, :precision => 20, :scale => 2 #=>提取储备基金
      t.decimal :withdrawal_reserve_for_business_expansion, :precision => 20, :scale => 2 #=>提取企业发展基金
      t.decimal :distribution_of_profits_for_shareholders, :precision => 20, :scale => 2 #=>可供股东分配的利润
      t.decimal :preferred_stock_dividends_payable, :precision => 20, :scale => 2 #=>应付优先股股利
      t.decimal :extraction_of_any_surplus_fund, :precision => 20, :scale => 2 #=>提取任意盈余公积金
      t.decimal :common_stock_dividends_payable, :precision => 20, :scale => 2 #=>应付普通股股利
      t.decimal :dividends_transferred_to_capital, :precision => 20, :scale => 2 #=>转作股本的普通股股利
      t.decimal :undivided_profit, :precision => 20, :scale => 2 #=>未分配利润

      t.timestamps
    end
  end

  def self.down
    drop_table :profit_statements
  end
end
